-
Notifications
You must be signed in to change notification settings - Fork 75
Add NoAsyncRunSynchronouslyInLibrary rule #785
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Add NoAsyncRunSynchronouslyInLibrary rule #785
Conversation
tests/FSharpLint.Core.Tests/Rules/Conventions/NoAsyncRunSynchronouslyInLibrary.fs
Show resolved
Hide resolved
src/FSharpLint.Core/Rules/Conventions/NoAsyncRunSynchronouslyInLibrary.fs
Outdated
Show resolved
Hide resolved
8fbe79e to
43fa62a
Compare
But we don't want the check to be just about the file but about the whole assembly. |
The whole assembly check will only work when linting project or solution. |
I know. That's why we don't recommend (show a warning) when only linting files. |
|
BTW, in my comment (#785 (comment)) I'm quoting some text from a commit msg, that either should be fixed (changed the wording), or implemented properly. |
After you have fixed the above, let's add 2 more commits:
|
75e8b61 to
b83aebd
Compare
b49d71b to
baecfb8
Compare
d562060 to
5f894e7
Compare
a2618d9 to
3dd6e70
Compare
Rule and tests for it.
No checks for assembly name yet.
Check assembly name. If it contains "test" substring, assume this is test project and don't fire the rule.
For NoAsyncRunSynchronouslyInLibrary rule that make sure that code inside NUnit and MSTest tests doesn't trigger the rule. Includes failing tests.
Check if Async.RunSynchronously call is iniside NUnit or MSTest tests. If it is, don't trigger the rule.
Add configuration for the rule and enable it by default.
Assembly.QualifiedName is empty, so instead check namespace and project name.
Simplified check for entry point. Also combined some code that uses args.CheckInfo to not pattern match on it twice.
That also calls `Async.RunSynchronously` and causes CI to fail.
Got rid of Async.RunSynchronously calls in FSharpLint.Core.
Suppress NoAsyncRunSynchronouslyInLibrary rule.
Exclude projects that have "console" in their name addition to those that contain "test".
Updated docs for NoAsyncRunSynchronouslyInLibrary to make clear what code is considered to be library code.
When linting project. This will give more information for rules to use, such as all types defined in an assembly.
For EntryPoint point attribute instead of just current file.
This reverts commit 7ba5ca4. Suppression is no longer needed because Benchmarks project has `[<EntryPoint>]` attribute which is now properly recognized.
Added 2 more tests for NoAsyncRunSynchronouslyInLibrary rule.
Make rule pass new tests by checking all nodes in the file for test attributes, not only parent nodes. Also when checking a project, check all files in the project for classes that are marked by test attributes.
That were removed in commit 9de63ea ("Core,Console,Tests: refactoring").
Methods and functions when applying the rule. Added 2 more tests. Marked non-async parsing methods re-introduced in previous commit with `[<Obsolete>]` attribute.
To address feedback.
ceb92d0 to
36609bd
Compare
|
Rebased. |
Added new NoAsyncRunSynchronouslyInLibrary rule and tests for it.